<?php
// +----------------------------------------------------------------------
// | Author: 发仔 <i@fazi.me> 
// +----------------------------------------------------------------------

namespace app\manual\controller;

use think\Controller;
use think\Db;

class Script extends Base
{
    function index() {

        $csv = file_get_contents('80.csv');
        $lines = array_filter( explode(PHP_EOL, $csv) );

        //委托
//        halt($lines);
        foreach ($lines as $key => $line) {

            $data = explode(',',$line);
            $name = $data[0] ?: $name;
//            halt($data);
//            $car[] = [$name,$data[1]];
//            $id = Db::name('company')->whereLike('company_name',$name)->value('company_id');
//            if(!$id) {
//                $id = Db::name('company')->insertGetId(['company_name'=> $name ]);
//            }
//            $rslt[] = Db::name('car')->whereLike('number',$data[1])->update(['company_id'=>243,'entrust_company_id'=>$id]);
        }

        halt($rslt);
	}
	
}
